'use strict';
const Service = require('egg').Service;
class UserService extends Service {
    async login(params) {
        const { ctx, app } = this;
        console.log('server=params=======>', params);
        // const username = ctx.query.username;// 获取页面中的username
        // const password = ctx.query.password;// 获取页面中的password
        const sel = await app.mysql.get('users', params);//在表名为users的表中 查询数据
        this.ctx.body += '';
        if (sel) {
            let res = {
                code: 200,
                message: '登录成功'
            }
            this.ctx.body = res;
        } if (sel == null) {
            this.ctx.body = '抱歉！登录失败，请重新登录';
        }

    }
}
module.exports = UserService;
